﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WoSoft.PACS.Win.MyControls
{
    public partial class Form_ColorSetting : Form
    {
        public int ld = 0;//亮度
        public int dbd = 0;//对比度
        public int bhd = 0;//饱和度
        public int sd = 0;//色度
        public int rd = 0;//锐度

        public Form_ColorSetting(int _ld,int _dbd,int _bhd,int _sd,int _rd)
        {
            InitializeComponent();
            ld = _ld;
            dbd = _dbd;
            bhd = _bhd;
            sd = _sd;
            rd = _rd;
        }

        private void trackBar_ld_ValueChanged(object sender, EventArgs e)
        {
            ld = trackBar_ld.Value;
            label_ld.Text = "亮度：" + ld.ToString();
        }

        private void trackBar_dbd_ValueChanged(object sender, EventArgs e)
        {
            dbd = trackBar_dbd.Value;
            label_dbd.Text = "对比度：" + dbd.ToString();
        }

        private void trackBar_bhd_ValueChanged(object sender, EventArgs e)
        {
            bhd = trackBar_bhd.Value;
            label_bhd.Text = "饱和度：" + bhd.ToString();
        }

        private void trackBar_sd_ValueChanged(object sender, EventArgs e)
        {
            sd = trackBar_sd.Value;
            label_sd.Text = "色度：" + sd.ToString();
        }

        private void trackBar_rd_ValueChanged(object sender, EventArgs e)
        {
            rd = trackBar_rd.Value;
            label_rd.Text = "锐度：" + rd.ToString();
        }

        private void Form_ColorSetting_Load(object sender, EventArgs e)
        {
            label_ld.Text = "亮度：" + ld.ToString();
            label_dbd.Text = "对比度：" + dbd.ToString();
            label_bhd.Text = "饱和度：" + bhd.ToString();
            label_sd.Text = "色度：" + sd.ToString();
            label_rd.Text = "锐度：" + rd.ToString();

            trackBar_ld.Value = ld;
            trackBar_dbd.Value = dbd;
            trackBar_bhd.Value = bhd;
            trackBar_sd.Value = sd;
            trackBar_rd.Value = rd;
        }

        private void button_default_Click(object sender, EventArgs e)
        {
            ld = 128;
            dbd = 68;
            bhd = 64;
            sd = 0;
            rd = -5;

            label_ld.Text = "亮度：" + ld.ToString();
            label_dbd.Text = "对比度：" + dbd.ToString();
            label_bhd.Text = "饱和度：" + bhd.ToString();
            label_sd.Text = "色度：" + sd.ToString();
            label_rd.Text = "锐度：" + rd.ToString();

            trackBar_ld.Value = ld;
            trackBar_dbd.Value = dbd;
            trackBar_bhd.Value = bhd;
            trackBar_sd.Value = sd;
            trackBar_rd.Value = rd;
        }

        private void button_close_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }
    }
}
